package com.nbsaas.boot.data.rest.convert;

import com.nbsaas.boot.data.data.entity.QueryTemplateHistory;
import com.nbsaas.boot.data.api.domain.simple.QueryTemplateHistorySimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* sql历史-列表对象转换器
*/

public class QueryTemplateHistorySimpleConvert implements Converter<QueryTemplateHistorySimple, QueryTemplateHistory> {




@Override
public QueryTemplateHistorySimple convert(QueryTemplateHistory source) {
    QueryTemplateHistorySimple result = new QueryTemplateHistorySimple();


               try {
                   if(source.getQueryTemplate()!=null){
                       result.setQueryTemplate(source.getQueryTemplate().getId());
                   }
                } catch (Exception ignored) { }


               try {
                   if(source.getCreator()!=null){
                       result.setCreator(source.getCreator().getId());
                   }
                } catch (Exception ignored) { }

                result.setId(source.getId());
                result.setAddDate(source.getAddDate());
                result.setContent(source.getContent());


    return result;
}

}